﻿/*
 *  Copyright (C) 2010 by Benjamin Nolmans <benjamin.nolmans@gmail.com>
 *  and Barbara Post <postb99@gmail.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

using System;
using OsamesFrameworkCore;
using OsamesFrameworkCore.Logging;

namespace OsamesFrameworkWeb
{
    public partial class Default : System.Web.UI.Page, ILoggable
    {
       protected void Page_Load(object sender_, EventArgs e_)
        {
            Log(LogLevel.Info, "Default.aspx.cs : page load");
        }

        protected void Page_Init(object sender_, EventArgs e_)
        {
            Log(LogLevel.Info, "Default.aspx.cs : page init");

            Log(LogLevel.Trace, "Default.aspx.cs : available plugins count : {0}", new object[]{OsamesFrameworkCore.Plugins.Management.PluginsManager.Instance.DicAvailablePluginSet.Count});
        }

        /// <summary>
        /// Logging facility.
        /// </summary>
        /// <param name="strMessage_">Message</param>
        /// <param name="strMessageDetails_">Optional array of message details. In this case, strMessage_ parameter contains placeholders, each matching a value in strMessageDetails_</param>
        /// <param name="eLogLevel_">Log level</param>
        public void Log(LogLevel eLogLevel_, string strMessage_, object[] strMessageDetails_ = null)
        {
            LoggerService.Log(this, eLogLevel_, strMessage_, strMessageDetails_);
        }

        /// <summary>
        /// Logging facility.
        /// </summary>
        /// <param name="eLogLevel_">Osames log level</param>
        /// <param name="strMessage_">Message</param>
        /// <param name="ex_">Exception we will log message and stack trace of</param>
        public void Log(LogLevel eLogLevel_, string strMessage_, Exception ex_)
        {
            LoggerService.Log(this, eLogLevel_, strMessage_, ex_);
        }
    }
}